package com.express.controller;

import com.express.pojo.Avatar;
import com.express.pojo.Hot;
import com.express.pojo.Image;
import com.express.service.impl.KeyWordServiceImpl;
import org.apache.ibatis.javassist.compiler.ast.Keyword;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
//admin控制层
@Controller
@RequestMapping("/admin")
public class AdminController {
    @Autowired
    private KeyWordServiceImpl keyWordService;


    @RequestMapping(value = "/queryallkeyword" )
    @ResponseBody
    public List queryallkeyword(){
        return keyWordService.queryallkeyword();
    }

    @CrossOrigin
    @RequestMapping(value = "/querypartkeyword",method = RequestMethod.GET)
    @ResponseBody
    public List<Keyword> querypartkeyword(@RequestParam("ishot") String ishot){
        return keyWordService.querypartkeyword(ishot);
    }
    @RequestMapping("/queryallhot")
    @ResponseBody
    public List<Hot> queryallhot(){
//        return keyWordService.queryallHot();
        return null;
    }
    @RequestMapping("/queryparthot")
    @ResponseBody
    public List<Hot> queryparthot(){
//        return keyWordService.queryparthot();
        return null;
    }
//    @RequestMapping("/queryallimage")
//    @ResponseBody
//    public List<Image> queryallimage(){
//        List<Image> list=keyWordService.queryallimage();
//        for(Image op:list){
//            op.setImage((byte[])(op.getImage()));
//        }
//        return keyWordService.queryallimage();
//    }
    @RequestMapping("searchexpression")
    @ResponseBody
    public List<HashMap<String,Object>> searchexpression(String searchvalue){
        List<HashMap<String,Object>> list=keyWordService.searchexpression(searchvalue);
        System.out.println(list);
        return list;
    }
    @RequestMapping("queryimagebytag")
    @ResponseBody
    public List<Image> queryimagebytag(String id){
        return keyWordService.queryimagebytag(id);
    }

    @RequestMapping("queryAvator")
    @ResponseBody
    public List<Avatar> queryAvator(String category){
        return keyWordService.queryAvator(category);
    }


}
